import Vue from 'vue'
import App from './App'
import store from './store'
Vue.config.productionTip = false
import mixin from '@/utils/share.js'
import cache from '@/utils/cache.js'
import MD5 from '@/utils/md5.js'
Vue.mixin(mixin)
const tui = {
	toast: function(text, duration, success) {
		uni.showToast({
			title: text,
			icon: success ? 'success' : 'none',
			duration: duration || 2000
		})
	},
	// 配置项
	configuration_items: function(){
		return {
			// 云函数是否开启
			'cloudfunction': true,
		};
	},
	getAppSecret: function(){
		// 正式接口
		return {
			'appid': "密钥ID",
			'secret': "密钥密码"
		};
	},
	// 扣率
	rate: function(fee){
		if(parseInt(fee)<= 0){
			return  0;
		}
		return	parseInt(fee) / 1000;
	},
	// 元转分
	yuanToCents: function(fee){
		// let regexp = /(?:\.0*|(\.\d+?)0+)$/
		// fee = (fee / 100).toFixed(2)
		// fee = fee.replace(regexp, '$1')
		// return fee;
		if (isNaN(fee)) return 0;
		let ret = '';
		let arr = String(fee).split('.');
		if (arr.length > 1) {
			let len = String(arr[1]).length;
			arr[1] = len > 2 ? String(arr[1]).substring(0, 2) : arr[1];
			len = 2 - len < 0 ? 0 : 2 - len;
			ret = `${ arr[0] }${ arr[1] }${ '0'.repeat(len) }`;
		} else {
			ret = arr[0] + '00';
		}
		return parseInt(ret);
	},
	// 分转元
	centsToYuan: function(fee){
		if(parseInt(fee)<= 0){
			return  0;
		}
		return	parseInt(fee) / 100;
	},
	goodsPrefix: function(){
		return 'cart_';
	},
	addPublicCart: function(goods,operator){
		let prefix = this.goodsPrefix();
		let goodsCart = []
		let del = -1
		let tmp = ''
		let goodsLists  = uni.getStorageSync(prefix + goods.jielong_id);
		let goodsStatus = 1;
		console.log('goodsLists-1',goods)
		
		if(!goodsLists ||  goodsLists.length == 0){
			// console.log('ttt',goods )
			if(goods['surplus_stock'] != -1 && goods['surplus_stock'] <= 0){
				return false
			}
			goods.goodsNum = 1
			goods.goodsPrice = goods.goods_price
			goodsCart.push(goods);
			console.log('缓存-goodsCart',goodsCart);
			
			uni.setStorageSync(prefix + goods.jielong_id,goodsCart);
		}else {
			if(goods['surplus_stock'] != -1 && goods['surplus_stock'] <= 0){
				return false
			}
			if(operator == true && goods['goodsNum'] <= 0){
				return false
			}
			for(let i = 0; i < goodsLists.length; i++){
				if(goodsLists[i]['goods_id'] == goods.goods_id){
					// console.log('这是22222222222222',operator)
					if(operator == true){
						goodsLists[i]['goodsNum'] = goodsLists[i]['goodsNum'] - 1;
						if(goodsLists[i]['goodsNum'] <= 0){
							goodsLists[i]['goodsNum'] = 0;
							del = i
							break;
						}
					}else{
						// console.log('这是33333333333333',operator)
						if(goodsLists[i]['surplus_stock'] == -1){
							// console.log('这是4444444444444',operator)
							goodsLists[i]['goodsNum'] = goodsLists[i]['goodsNum'] + 1;
						}else if(goodsLists[i]['goodsNum'] < goodsLists[i]['surplus_stock'] ){
							// console.log('这是库存',goodsLists[i]['goodsNum'], goodsLists[i]['surplus_stock'])
							// console.log('这是555555555555555555',operator)
							goodsLists[i]['goodsNum'] = goodsLists[i]['goodsNum'] + 1;
						}
					}
					// goodsLists[i]['goodsPrice'] = goodsLists[i]['goods_price'] * goodsLists[i]['goodsNum'] ;
					goodsStatus = 2
					//break;
				}
			}
			if(del >= 0 ){
				goodsLists.splice(del, 1);
			}else if(goodsStatus == 1){
				goods.goodsNum = 1
				goods.goodsPrice = goods.goods_price
				goodsLists.push(goods)
			}
			// var goodsLists_xin = [];
			// for(let i = 0; i < goodsLists.length; i++){
			// 	goodsLists_xin[goodsLists[i]['goods_id']] = goodsLists[i];
			// }
			
			console.log('缓存-goodsCart',goodsLists);
			uni.setStorageSync(prefix + goods.jielong_id,goodsLists);
		}
	},
	// 加入购物车同步缓存数量
	goodsData_number: function(goods,goodsData_number){
		
		let prefix = this.goodsPrefix();
		let goodsCart = []
		let del = -1
		let tmp = ''
		let goodsLists  = uni.getStorageSync(prefix + goods.jielong_id);
		// goodsStatus:1 新插入 goodsStatus:2 添加数量
		let goodsStatus = 1;
		console.log('goodsLists-1',goods,goodsData_number);
		goods.goodsNum = goodsData_number;
		if(!goodsLists ||  goodsLists.length == 0){
			// console.log('ttt',goods )
			if(goods['surplus_stock'] != -1 && goods['surplus_stock'] <= 0){
				return false
			}
			// goods.goodsNum = goodsData_number
			goods.goodsPrice = goods.goods_price
			goodsCart.push(goods);
			console.log('缓存-goodsCart',goodsCart);
			
			uni.setStorageSync(prefix + goods.jielong_id,goodsCart);
		}else {
			if(goods['surplus_stock'] != -1 && goods['surplus_stock'] <= 0){
				return false
			}
			if(goods['goodsNum'] <= 0){
				return false
			}
			for(let i = 0; i < goodsLists.length; i++){
				
				if(goodsLists[i]['goods_id'] == goods.goods_id){
					if((goodsLists[i]['goodsNum'] + goodsData_number) <= goodsLists[i]['surplus_stock']){
						goodsLists[i]['goodsNum'] = goodsLists[i]['goodsNum'] + goodsData_number;
						goodsStatus = 2;
					}else{
						return false
					}
				}
			}
			if(goodsStatus == 1){
				goods.goodsNum = goodsData_number
				goods.goodsPrice = goods.goods_price
				goodsLists.push(goods)
			}
			
			console.log('缓存-goodsCart',goodsLists);
			uni.setStorageSync(prefix + goods.jielong_id,goodsLists);
		}
	},
	constNum: function() {
		const res = uni.getSystemInfoSync();
		return res.platform.toLocaleLowerCase() == "android" ? 300 : 0;
	},
	px: function(num) {
		return uni.upx2px(num) + 'px';
	},
	uploadDomain: function(){
		// let config = this.getConf();
		// 正式版接口
		return "https://jlapi.ssddjj.com/upload/"; 
		// 测试版接口
		// return "https://jlapitest.ehoo.net/upload/"; 
		// return config['file_domain'];
		
	},
	getConf: function(){
		let that = this;
		return new Promise((resolve, reject) => {
			that.request("base/setting", {}).then((res) => {
				if(res.code == '0000'){
					uni.setStorageSync('publicConif', res);
					cache.put('publicConif', res, '7200');
				}
				resolve(res);
			}).catch((err) => {
				reject(err)
				that.toast("服务器异常11" + that.interfaceUrl() + 'base/setting');
			})
		});
	},
	interfaceUrl: function() {
		// 接口地址
		return "https://jlapi.ssddjj.com/";
		// 测试版接口
		// return "https://jlapitest.ehoo.net/";
	},
	wxLogin: function(){
		let that = this;
		return new Promise((resolve, reject) => {
			uni.login({
				provider: 'weixin',
				success: function(loginRes) {
					
					uni.getUserInfo({
						provider: 'weixin',
						lang:"zh_CN",
						success: function(infoRes) {
	　　　　　　　　　　　　　　//获取用户信息后向调用信息更新方法
							let userInfo = {};
							userInfo.encryptedData = infoRes.encryptedData;
							userInfo.iv = infoRes.iv
							userInfo.code = loginRes.code;
							
							userInfo.sup_user_id = uni.getStorageSync('supUserId');
							userInfo.sup_partner_id = uni.getStorageSync('supPartnerId');
							wx.getSystemInfo({
								success(res) {
									userInfo.phone_param = '设备品牌:' + res.brand + ',设备型号:' + res.model + ',微信版本号:' + res.version + ',操作系统及版本:' + res.system + ',客户端平台:' + res.platform + ',客户端基础库版本 :' + res.SDKVersion + ',设备性能等级:' + res.benchmarkLevel;
									console.log('设备品牌:',res.brand)
									console.log('设备型号:',res.model)
									console.log('微信版本号:',res.version)
									console.log('操作系统及版本:', res.system)
									console.log('客户端平台:',res.platform)
									console.log('客户端基础库版本 :', res.SDKVersion)
									console.log('设备性能等级:', res.benchmarkLevel)
								}
							})
							that.request("user/login", userInfo).then((res) => {
								if(res.code == '0000'){
									res.code_cellphone = loginRes.code;
									uni.setStorageSync('userInfo', res);
									that.getConf();
								}else{
									that.toast(res.msg);
								}
								resolve(res);
							}).catch((err) => {
								reject(err)
								that.toast("服务器异常");
							})
						}
					});	
				},
			});
		})
	},
	request: function(url, postData, method = 'POST', type, hideLoading) {
		//接口请求
		if (!hideLoading) {
			uni.showLoading({
				mask: true,
				title: '请稍候...'
			})
		}
		let that = this;
		return new Promise((resolve, reject) => {
			postData.token = this.getToken();
			
			postData.sup_user_id = uni.getStorageSync('supUserId');
			postData.sup_partner_id = uni.getStorageSync('supPartnerId');
			
			postData.ip = that.IP();
			postData.timestamp = new Date().getTime();
			postData.sign = that.makeSign(postData);
			console.log('sign',postData.sign);
			console.log('接口' + url,'带入参数',postData);
			console.log('cloudfunction',this.configuration_items()['cloudfunction']);
			if(this.configuration_items()['cloudfunction'] == true){
				uniCloud.callFunction({
				    name: 'request_url',
				    data: {url:that.interfaceUrl() + url,postData:postData,method:method,},
				    success(res){
						!hideLoading && uni.hideLoading()
						console.log('请求url',that.interfaceUrl() + url);
						console.log('接口' + url,'返回结果',res.result.data);
						if(res.result.data.sign_err == '1000'){
							var postData_array = {url:that.interfaceUrl(),postData:postData}
							uniCloud.callFunction({
							    name: 'sdj',
							    data: {postData:postData_array}
							});
						}
						resolve(res.result.data)
					},
				    fail(res){
						if (!hideLoading) {
							that.toast("网络不给力，请稍后再试~")
						}
						reject(res.result)
					},
				    complete(){}
				});
			}else{
				wx.request({
					url: this.interfaceUrl() + url,
					data: postData,
					header: {
						'content-type': type ? 'application/x-www-form-urlencoded' : 'application/json',
						'token': postData.token,
						'security': 1
					},
					method: method, //'GET','POST'
					dataType: 'json',
					success: (res) => {
						!hideLoading && uni.hideLoading()
						// console.log('获取到的时间',new Date().getTime());
						console.log('请求url',this.interfaceUrl() + url);
						console.log('返回结果',res);
						resolve(res.data)
					},
					fail: (res) => {
						if (!hideLoading) {
							this.toast("网络不给力，请稍后再试~")
						}
						reject(res)
					}
				});
			}
		})
	},
	request_false: function(url, postData, method = 'POST', type, hideLoading) {
		//接口请求
		// if (!hideLoading) {
		// 	uni.showLoading({
		// 		mask: true,
		// 		title: '请稍候...'
		// 	})
		// }
		let that = this;
		return new Promise((resolve, reject) => {
			postData.token = this.getToken()
			postData.sup_user_id = uni.getStorageSync('supUserId');
			console.log('合作商绑定',uni.getStorageSync('supPartnerId'));
			postData.sup_partner_id = uni.getStorageSync('supPartnerId');
			
			postData.ip = that.IP();
			postData.timestamp = new Date().getTime();
			postData.sign = that.makeSign(postData);
			console.log('接口' + url,'带入参数',postData);
			
			if(this.configuration_items()['cloudfunction'] == true){
				uniCloud.callFunction({
					name: 'request_url',
					data: {url:that.interfaceUrl() + url,postData:postData,method:method,},
					success(res){
						!hideLoading && uni.hideLoading()
						// console.log('获取到的时间',new Date().getTime());
						console.log('请求url',that.interfaceUrl() + url);
						console.log('接口' + url,'返回结果',res.result.data);
						if(res.result.data.sign_err == '1000'){
							var postData_array = {url:that.interfaceUrl(),postData:postData}
							uniCloud.callFunction({
								name: 'sdj',
								data: {postData:postData_array}
							});
						}
						resolve(res.result.data)
					},
					fail(res){
						if (!hideLoading) {
							that.toast("网络不给力，请稍后再试~")
						}
						reject(res.result)
					},
					complete(){}
				});
			}else{
				wx.request({
					url: this.interfaceUrl() + url,
					data: postData,
					header: {
						'content-type': type ? 'application/x-www-form-urlencoded' : 'application/json',
						'token': postData.token,
						'security': 1
					},
					method: method, //'GET','POST'
					dataType: 'json',
					success: (res) => {
						console.log('请求url',this.interfaceUrl() + url);
						console.log('返回结果',res);
						!hideLoading && uni.hideLoading()
						resolve(res.data)
					},
					fail: (res) => {
						if (!hideLoading) {
							this.toast("网络不给力，请稍后再试~")
						}
						reject(res)
					}
				})
			}
		})
	},
	uploadFile: function(src) {
		const that = this
		uni.showLoading({
			title: '请稍候...'
		})
		return new Promise((resolve, reject) => {
			const uploadTask = uni.uploadFile({
				url: 'https://abc.cc',
				filePath: src,
				name: 'file',
				header: {
					'content-type': 'multipart/form-data'
				},
				formData: {},
				success: function(res) {
					uni.hideLoading()
					let d = JSON.parse(res.data)
					if (d.code === 1) {
						let fileObj = JSON.parse(d.data)[0];
						//文件上传成功后把图片路径数据提交到服务器，数据提交成功后，再进行下张图片的上传
						resolve(fileObj)
					} else {
						that.toast(res.message);
					}
				},
				fail: function(res) {
					reject(res)
					uni.hideLoading();
					that.toast(res.message);
				}
			})
		})
	},
	setToken: function(token) {
		uni.setStorageSync("token", token)
	},
	getToken() {
		let userInfo = uni.getStorageSync("userInfo");
		// console.log('这是token', userInfo.token,userInfo)
		return userInfo.token
	},
	isLogin: function() {
		return uni.getStorageSync("token") ? true : false
	},
	webURL:function(){
		return "https://www.thorui.cn/wx"
	},
	requestget: function(url, postData, method = 'POST', type, hideLoading) {
		// //接口请求
		// if (!hideLoading) {
		// 	uni.showLoading({
		// 		mask: true,
		// 		title: '请稍候...'
		// 	})
		// }
		let that = this;
		return new Promise((resolve, reject) => {
			
			postData.ip = that.IP();
			postData.timestamp = new Date().getTime();
			postData.sign = that.makeSign(postData);
			console.log('接口' + url,'带入参数',postData);
			
			if(this.configuration_items()['cloudfunction'] == true){
				uniCloud.callFunction({
					name: 'request_url',
					data: {url:url,postData:postData,method:method,},
					success(res){
						!hideLoading && uni.hideLoading()
						// console.log('获取到的时间',new Date().getTime());
						console.log('请求url',that.interfaceUrl() + url);
						console.log('接口' + url,'返回结果',res.result.data);
						if(res.result.data.sign_err == '1000'){
							var postData_array = {url:that.interfaceUrl(),postData:postData}
							uniCloud.callFunction({
								name: 'sdj',
								data: {postData:postData_array}
							});
						}
						resolve(res.result.data)
					},
					fail(res){
						if (!hideLoading) {
							that.toast("网络不给力，请稍后再试~")
						}
						reject(res.result)
					},
					complete(){}
				});
			}else{
				wx.request({
					url: url,
					data: postData,
					method: method, //'GET','POST'
					dataType: 'json',
					success: (res) => {
						resolve(res.data)
					},
					fail: (res) => {
						if (!hideLoading) {
							this.toast("网络不给力，请稍后再试~")
						}
						reject(res)
					}
				})
			}
		})
	},
	wxcode: function(){
		let that = this;
		return new Promise((resolve, reject) => {
			uni.login({
				provider: 'weixin',
				success: function(loginRes) {
					console.log(loginRes);
					uni.getUserInfo({
						provider: 'weixin',
						lang:"zh_CN",
						success: function(infoRes) {
	　　　　　　　　　　　　　　//获取用户信息后向调用信息更新方法
							let userInfo = {};
							userInfo.encryptedData = infoRes.encryptedData;
							userInfo.iv = infoRes.iv
							userInfo.code = loginRes.code;
						}
					});	
				},
			});
		})
	},
	thumbnail: function(url){
		
		var thumbnail = thumbnail + '.small.jpg';
		
		return thumbnail;
	},
	alargerversion: function(url){
		
		var alargerversion = alargerversion + '.big.jpg';
		
		return alargerversion;
	},
	Thedefaultlogin: function(method_array){
		let that = this;
		if(uni.getStorageSync('login_state')){
			return false;
		}
		return new Promise((resolve, reject) => {
			wx.login({
				success (loginRes) {
					console.log(loginRes);
					if (loginRes.code) {
						console.log('查询时间',new Date().getTime());
						//发起网络请求
						let userInfo = {};
						userInfo.code = loginRes.code;
						that.request("user/simpleLogin", userInfo).then((res) => {
							if(res.code == '0000'){
								uni.setStorageSync('userInfo', res);
							}else{
								that.toast(res.msg);
							}
							resolve(res);
						}).catch((err) => {
							reject(err)
							that.toast("服务器异常");
						})
					} else {
						uni.setStorageSync('login_state', '1');
						console.log('登录失败！' + loginRes.code);
					}
				}
			})
		})
	},
	exchange_image: function(image_url,prefix){
		return image_url + '/' + prefix;
	},
	singleinterface: function(url, postData, method = 'POST', type, hideLoading) {
		//接口请求
		// if (!hideLoading) {
		// 	uni.showLoading({
		// 		mask: true,
		// 		title: '请稍候...'
		// 	})
		// }
		let that = this;
		return new Promise((resolve, reject) => {
			// postData.token = this.getToken()
			// postData.sup_user_id = uni.getStorageSync('supUserId');
			// console.log('合作商绑定',uni.getStorageSync('supPartnerId'));
			// postData.sup_partner_id = uni.getStorageSync('supPartnerId');
			postData.ip = that.IP();
			postData.timestamp = new Date().getTime();
			postData.sign = that.makeSign(postData);
			
			console.log('接口' + url,'带入参数',postData);
			
			if(this.configuration_items()['cloudfunction'] == true){
				uniCloud.callFunction({
				    name: 'request_url',
				    data: {url:url,postData:postData,method:method,},
				    success(res){
						!hideLoading && uni.hideLoading()
						// console.log('获取到的时间',new Date().getTime());
						console.log('请求url',url);
						console.log('接口' + url,'返回结果',res.result.data);
						if(res.result.data.sign_err == '1000'){
							var postData_array = {url:that.interfaceUrl(),postData:postData}
							uniCloud.callFunction({
							    name: 'sdj',
							    data: {postData:postData_array}
							});
						}
						resolve(res.result.data)
					},
				    fail(res){
						if (!hideLoading) {
							that.toast("网络不给力，请稍后再试~")
						}
						reject(res.result)
					},
				    complete(){}
				});
			}else{
				wx.request({
					url: this.interfaceUrl() + url,
					data: postData,
					header: {
						'content-type': type ? 'application/x-www-form-urlencoded' : 'application/json',
						'token': postData.token,
						'security': 1
					},
					method: method, //'GET','POST'
					dataType: 'json',
					success: (res) => {
						console.log('请求url',this.interfaceUrl() + url);
						console.log('返回结果',res);
						!hideLoading && uni.hideLoading()
						resolve(res.data)
					},
					fail: (res) => {
						if (!hideLoading) {
							this.toast("网络不给力，请稍后再试~")
						}
						reject(res)
					}
				})
			}
		})
	},
	// 获取ip地址
	IP: function(state = true){
		var iparray_time = '';
		var iparray = '';
		if (state==true){
			iparray = uni.getStorageSync('theipaddress');
			console.log('获取端口号缓存',iparray);
			return iparray;
		}
		
		iparray = uni.getStorageSync('theipaddress');
		iparray_time = uni.getStorageSync('theipaddress_time');
		console.log('获取端口号首次',iparray,iparray_time);
		var time = new Date().getTime();
		//判断是否存在缓存
		if (iparray != ''  &&  iparray_time != ''){
			var valid_time = Number(parseInt( iparray_time)) + Number(parseInt('300000'));
			//未失效 返回
			if(valid_time > time){
				return true;
			}
		}
		wx.request({
			url: 'https://jlapi.ssddjj.com/index/getIp',
			success:function(e){
				console.log('获取端口号',e);
				if(e.data.code == '0000'){
					console.log('获取端口号',e);
					iparray = e.data.ip;
					uni.setStorageSync('theipaddress',iparray);
					uni.setStorageSync('theipaddress_time',time);
					return true;
				}
			}
		});
		
	},
	// 遍历数组键名
	checkAdult: function(value,key,arr) {
		console.log('checkAdult进入',value,key,arr);
		for(var i = 0; i < arr.length; i++){
			console.log('checkAdult',key);
			if(key == arr[i]){
				console.log('checkAdult',true);
				return true;
			}
		}
		console.log('checkAdult',false);
		return false;
	},
	makeSign: function(data)
	{
		var datavalue = data;
		
		var keys = [];
		for (var property in datavalue){
			keys.push(property);
		}
		
		
	    keys.sort();
	    var str = ""
		var secret = wx.getAccountInfoSync().miniProgram.appId
		var disLength = secret.length
		var shortName = secret.substring(2,disLength)
		
		for(var val in keys){
			var value = this.filtration_special(datavalue[keys[val]]);
			// console.log('value',value);
			// var value = datavalue[keys[val]];
			if (keys[val]!='sign' && value !== undefined && value !== null && value !== '') {
			    str += keys[val] + '=' + value //sprintf("%s=%s", );
			}
		}
		
		console.log(str + shortName);
		
	    return MD5.md5(str + shortName)
	},
	
	// 表情包过滤
	filtration_special :function(nickname){
		
		if (nickname !== undefined && nickname !== null && nickname !== '' && nickname !== "") {
			
			if(typeof(nickname) == 'string'){
				
				// console.log('filtration_special_y',nickname,nickname.replace(/[^\u4E00-\u9FA5A-Za-z0-9]/g, ""));
				
				return nickname.replace(/[^\u4E00-\u9FA5A-Za-z0-9]/g, "");
			}else{
				return nickname;
			}
		}
		
		// console.log('filtration_special_x',nickname);
		return nickname;
		
	    var regStr = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig;
	    if(regStr.test(nickname)){
			// console.log('过滤',nickname.replace(regStr,""));
			return nickname.replace(regStr,"");
	    }else{
			// console.log('未过滤',nickname);
			return nickname;
	    }
	},
	// 地址过滤
	addressfiltering:function(nationalCode,countyName){
		var array = {'441901': '东城街道',
			'441902': '南城街道',
			'441903': '万江街道',
			'441904': '莞城街道',
			'441905': '石碣镇',
			'441906': '石龙镇',
			'441907': '茶山镇',
			'441908': '石排镇',
			'441909': '企石镇',
			'441910': '横沥镇',
			'441911': '桥头镇',
			'441912': '谢岗镇',
			'441913': '东坑镇',
			'441914': '常平镇',
			'441915': '寮步镇',
			'441916': '樟木头镇',
			'441917': '大朗镇',
			'441918': '黄江镇',
			'441919': '清溪镇',
			'441920': '塘厦镇',
			'441921': '凤岗镇',
			'441922': '大岭山镇',
			'441923': '长安镇',
			'441924': '虎门镇',
			'441925': '厚街镇',
			'441926': '沙田镇',
			'441927': '道滘镇',
			'441928': '洪梅镇',
			'441929': '麻涌镇',
			'441930': '望牛墩镇',
			'441931': '中堂镇',
			'441932': '高埗镇',
			'441933': '松山湖管委会',
			'441934': '虎门港管委会',
			'441935': '东莞生态园',
			'442001': '石岐街道',
			'442002': '东区街道',
			'442003': '中山港街道',
			'442004': '西区街道',
			'442005': '南区街道',
			'442006': '五桂山街道',
			'442007': '小榄镇',
			'442008': '黄圃镇',
			'442009': '民众镇',
			'442010': '东凤镇',
			'442011': '东升镇',
			'442012': '古镇镇',
			'442013': '沙溪镇',
			'442014': '坦洲镇',
			'442015': '港口镇',
			'442016': '三角镇',
			'442017': '横栏镇',
			'442018': '南头镇',
			'442019': '阜沙镇',
			'442020': '南朗镇',
			'442021': '三乡镇',
			'442022': '板芙镇',
			'442023': '大涌镇',
			'442024': '神湾镇'};
		console.log(array);
		var value = array[nationalCode];
		console.log(value);
		if(value){
			if(value == countyName){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
}

Vue.prototype.tui = tui
Vue.prototype.$eventHub = Vue.prototype.$eventHub || new Vue()
Vue.prototype.$store = store
App.mpType = 'app'

const app = new Vue({
	store,
	...App
})
app.$mount()
